public class Point {
	public final double x , y , z ;
	public final int dimension ;
	
	public Point ( double x0 , double y0 ) {
		x = x0 ;
		y = y0 ;
		z = 0 ;
		dimension = 2 ;
	}
	
	public String toString ( ) {
		String result = "(" + x + "," + y ;
		if ( dimension == 3 )
			result += "," + z ;
		return result + ")" ;
	}
	
	public Point ( double x , double y , double z ) {
		this.x = x ;
		this.y = y ;
		this.z = z ;
		dimension = 3 ;
	}
	
	public double distSquaredTo ( Point p ) {
		return Math.pow ( x - p.x , 2 ) + Math.pow ( y - p.y , 2 ) + Math.pow ( z - p.z , 2 ) ;
	}
	
	public double distTo ( Point p ) {
		return Math.sqrt ( distSquaredTo ( p ) ) ;
	}
	
	public boolean coincidesWith ( Point p ) {
		return ( z == p.z ) && ( y == p.y ) && ( x == p.x ) ;
	}
}
